

//添加“静态方法”
$.extend({
	
    //document文档树的宽度和高度
    documentWidth: function(){
        return $(document).width();
    },
    documentHeight: function(){
        return $(document).height();
    },
	
    //window窗口的宽度和高度
    windowWidth: function(){
        if($.browser.msie){
            return document.compatMode == "CSS1Compat"? document.documentElement.clientWidth:document.body.clientWidth;
        } else{
            return self.innerWidth;
        }
    },
    windowHeight: function(){
        if($.browser.msie){
            return document.compatMode == "CSS1Compat"? document.documentElement.clientHeight:document.body.clientHeight;
        } else{
            return self.innerHeight;
        }
    }
	
});

//添加“成员函数”
$.fn.extend({
	
    //获得当前元素位于document文档树的位置
    documentOffset: function(){
        var obj = $(this);
        var newObject = new Object();
        newObject.top = obj.offset().top;
        newObject.bottom = $.documentHeight() - newObject.top - obj.height();
        newObject.left = obj.offset().left;
        return newObject;
    },
	
    //获得当前元素位于window窗口的位置
    windowOffset: function(){
        var obj = $(this);
        var offset = obj.offset();
        var newObject = new Object();
        newObject.top = obj.offset().top-(document.documentElement.scrollTop + document.body.scrollTop);
        newObject.bottom = $.windowHeight() - newObject.top;
        newObject.left = ( $.windowWidth() - (obj.width() + parseInt(obj.css("padding-left")) + parseInt(obj.css("padding-right")) )) / 2 ;
        //left = ($(window).width() - (dialog_mask.width()+parseInt(dialog_mask.css("padding-left"))+parseInt(dialog_mask.css("padding-right")))) / 2,
        return newObject;
    }
});





